module: add some kconfigs and do some cleanup#10085
Merged
lgirdwood merged 4 commits intothesofproject:mainfrom Jul 3, 2025
Merged
module: add some kconfigs and do some cleanup#10085lgirdwood merged 4 commits intothesofproject:mainfrom
lgirdwood merged 4 commits intothesofproject:mainfrom
Conversation
API_CALL only used to wrap Cadence API calls so move to correct header. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Currently max number of connected sources and sinks is hard coded. Make this Kconfig to support different connections counts and validate the count is within limits. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Currently max blob size is hard coded. make it a kconfig so it can be tuned for needs. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
There was a problem hiding this comment.
Pull Request Overview
This PR replaces hard-coded module limits and blob size constants with Kconfig-driven values, adds validation for connection counts, and cleans up duplicate macro definitions.
- Introduce
CONFIG_MODULE_MAX_CONNECTIONSandCONFIG_MODULE_MAX_BLOB_SIZEKconfig options - Update array sizes and runtime checks to use the new configurable limits
- Remove
MAX_BLOB_SIZEandMODULE_MAX_SOURCESmacros and relocateAPI_CALLtocadence.h
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/include/sof/audio/module_adapter/module/generic.h | Removed hard-coded size macros and duplicate API_CALL definition |
| src/include/sof/audio/module_adapter/module/cadence.h | Added API_CALL macro |
| src/include/module/module/base.h | Switched sink/source arrays to CONFIG_MODULE_MAX_CONNECTIONS |
| src/audio/module_adapter/module_adapter.c | Added runtime check for exceeding connection limits |
| src/audio/module_adapter/module/generic.c | Replaced MAX_BLOB_SIZE with CONFIG_MODULE_MAX_BLOB_SIZE |
| src/audio/Kconfig | Added MODULE_MAX_CONNECTIONS and MODULE_MAX_BLOB_SIZE entries |
Comments suppressed due to low confidence (3)
src/audio/module_adapter/module_adapter.c:277
- [nitpick] The error message could be clearer by naming both values explicitly (e.g.,
sinks=%u, sources=%u) so it’s unambiguous which counts exceeded the limit.
comp_err(dev, "module_adapter_prepare(): too many connected sinks %d or sources %d!",
src/audio/module_adapter/module_adapter.c:275
- This new validation branch for too many connections should be covered by unit tests to verify that
module_adapter_prepare()fails correctly when exceedingCONFIG_MODULE_MAX_CONNECTIONS.
if (mod->num_of_sources > CONFIG_MODULE_MAX_CONNECTIONS ||
src/include/module/module/base.h:103
- The comment still references the old
MODULE_MAX_SOURCES; update it to mentionCONFIG_MODULE_MAX_CONNECTIONSto keep documentation in sync with the code change.
/* sink and source handlers for the module */
| extern xa_codec_func_t xa_vorbis_dec; | ||
| extern xa_codec_func_t xa_src_pp; | ||
|
|
||
| #define API_CALL(cd, cmd, sub_cmd, value, ret) \ |
There was a problem hiding this comment.
The API_CALL macro is now defined here and was removed from generic.h, but duplicating it in multiple module headers can lead to drift. Consider moving this macro to a common header (e.g., module_api.h) to keep definitions centralized.
Add a descriptive comment and align some doxygen comments. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
lyakh
approved these changes
Jul 2, 2025
kv2019i
approved these changes
Jul 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add more flexibility to module configuration and a little clean up.